package appconfig

import (
	"fmt"

	"github.com/spf13/viper"
)

type Mysql struct {
	User     string
	Password string
	Host     string
	Port     int
	Database string
}

type Redis struct {
	Host     string
	Port     int
	Password string
	Database int
}

type AppConfig struct {
	Mysql Mysql
	Redis Redis
}

var Config AppConfig

func Init() {
	viper.SetConfigFile("appconfig/dev.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Config)
	fmt.Println("配置成功", Config)
}
